home *** CD-ROM | disk | FTP | other *** search
ASP.NET Web Form | 2002-03-17 | 5.3 KB | 102 lines |
- <%@ Page Language="vb" AutoEventWireup="false" Codebehind="DataListForm.aspx.vb" Inherits="DataBinding.DataListForm" trace="True" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <HTML>
- <HEAD>
- <title>DataListForm</title>
- <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
- <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
- <meta content="JavaScript" name="vs_defaultClientScript">
- <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
- </HEAD>
- <body>
- <form id="Form1" method="post" runat="server">
- <H1 style="FONT-SIZE: large; FONT-FAMILY: 'Arial Black'">DataList Control Demo</H1>
- <P style="FONT-SIZE: large; FONT-FAMILY: 'Arial Black'"><FONT face="Times New Roman" size="3">The
- first DataList control on this page demonstrates several features of the
- DataList control, including select and edit templates. The second
- DataList demonstrates that you can render its contents using any layout (not
- necessarily an HTML table); you can use it to display all the image files in a
- directory on the server that you select.</FONT></P>
- <HR width="100%" SIZE="1">
- <P style="FONT-SIZE: large; FONT-FAMILY: 'Arial Black'">A DataList displaying books</P>
- <P>
- <asp:datalist id="dlstBooks" runat="server" Width="538px">
- <HeaderTemplate>
- <DIV style="COLOR: white; FONT-FAMILY: 'Arial Black'; BACKGROUND-COLOR: navy">Click
- on [X] to select and edit a book</DIV>
- </HeaderTemplate>
- <SelectedItemTemplate>
- <DIV style="BACKGROUND-COLOR: blue">Title:
- <asp:Label id=Label7 runat="server" Width="547px" Text='<%# Container.DataItem("Title") %>' Font-Bold="True">
- </asp:Label><BR>
- Publisher:
- <asp:Label id=lblPublisher runat="server" Width="170px" Text='<%# Container.DataItem("pub_name") %>' Font-Bold="True">
- </asp:Label>Type:
- <asp:Label id=lblType runat="server" Width="168px" Text='<%# Container.DataItem("Type") %>' Font-Bold="True">
- </asp:Label>Price:
- <asp:Label id=lblPrice runat="server" Width="83px" Text='<%# Container.DataItem("Price") %>' Font-Bold="True">
- </asp:Label>
- <asp:Button id="Button2" runat="server" Text="Edit" CommandName="Edit"></asp:Button>
- <asp:Button id="Button4" runat="server" Text="Delete" CommandName="delete"></asp:Button>
- </DIV>
- </SelectedItemTemplate>
- <FooterTemplate>
- <DIV style="COLOR: white; FONT-FAMILY: 'Arial Black'; BACKGROUND-COLOR: navy">End
- of list</DIV>
- </FooterTemplate>
- <ItemTemplate>
- <asp:LinkButton id="Linkbutton3" runat="server" CommandName="select">[X]</asp:LinkButton>
- <asp:Label id=Label5 runat="server" Width="559px" Text='<%# Container.DataItem("Title") %>'>
- </asp:Label>
- </ItemTemplate>
- <AlternatingItemTemplate>
- <DIV style="BACKGROUND-COLOR: yellow">
- <asp:LinkButton id="Linkbutton4" runat="server" CommandName="select">[X]</asp:LinkButton>
- <asp:Label id=Label6 runat="server" Width="561px" Text='<%# Container.DataItem("Title") %>'>
- </asp:Label></DIV>
- </AlternatingItemTemplate>
- <EditItemTemplate>
- <DIV style="BACKGROUND-COLOR: blue">Title:
- <asp:TextBox id=txtTitle runat="server" Width="500px" Text='<%# Container.DataItem("Title") %>'>
- </asp:TextBox><BR>
- Publisher:
- <asp:Literal id=litPubId Text='<%# Container.DataItem("pub_id") %>' Visible="False" Runat="server">
- </asp:Literal>
- <asp:DropDownList id="ddlPublishers" runat="server" Width="170px" DataTextField="pub_name" DataValueField="pub_id"></asp:DropDownList>Type:
- <asp:TextBox id=txtType runat="server" Width="168px" Text='<%# Container.DataItem("Type") %>'>
- </asp:TextBox>Price:
- <asp:TextBox id=txtPrice runat="server" Width="83px" Text='<%# Container.DataItem("Price") %>'>
- </asp:TextBox>
- <asp:Button id="Button1" runat="server" Text="Update" CommandName="update"></asp:Button>
- <asp:Button id="Button3" runat="server" Text="Cancel" CommandName="cancel"></asp:Button>
- </DIV>
- </EditItemTemplate>
- </asp:datalist></P>
- <P> </P>
- <P style="FONT-SIZE: large; FONT-FAMILY: 'Arial Black'">A DataList displaying
- images</P>
- <P style="FONT-SIZE: medium">Type a directory path:
- <asp:TextBox id="txtPath" runat="server" Width="306px"></asp:TextBox>
- <asp:Button id="btnDisplay" runat="server" Width="109px" Text="Display Images"></asp:Button></P>
- <P>
- <asp:DataList id="dlstFiles" runat="server" RepeatDirection="Horizontal" RepeatColumns="4">
- <ItemTemplate>
- <P>
- <asp:Image id=imgFile runat="server" Width="140px" ImageUrl="<%# Container.DataItem %>" BorderWidth="1" Height="100px">
- </asp:Image><BR>
- <asp:CheckBox id=chkFile runat="server" Text="<%# System.Io.Path.GetFileName(Container.DataItem) %>">
- </asp:CheckBox></P>
- </ItemTemplate>
- </asp:DataList></P>
- <P>
- <asp:Button id="btnDisplayFileNames" runat="server" Text="Display names of selected files"></asp:Button></P>
- <P>
- <asp:Repeater id="rptFilenames" runat="server">
- <ItemTemplate>
- <%# Container.DataItem %><br />
- </ItemTemplate>
- </asp:Repeater></P>
- </form>
- </body>
- </HTML>
-